<!-- HTML header for doxygen 1.9.6-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>CMSIS-Driver: vStream</title>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<script type="text/javascript" src="tabs.js"></script>
<script type="text/javascript" src="footer.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
  $(document).ready(function() { init_search(); });
/* @license-end */
</script>
<script type="text/javascript" src="darkmode_toggle.js"></script>
<link href="extra_stylesheet.css" rel="stylesheet" type="text/css"/>
<link href="extra_navtree.css" rel="stylesheet" type="text/css"/>
<link href="extra_search.css" rel="stylesheet" type="text/css"/>
<link href="extra_tabs.css" rel="stylesheet" type="text/css"/>
<link href="version.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../version.js"></script>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 55px;">
  <td id="projectlogo" style="padding: 1.5em;"><img alt="Logo" src="cmsis_logo_white_small.png"/></td>
  <td style="padding-left: 1em; padding-bottom: 1em;padding-top: 1em;">
   <div id="projectname">CMSIS-Driver
   &#160;<span id="projectnumber"><script type="text/javascript">
     <!--
     writeHeader.call(this);
     writeVersionDropdown.call(this, "CMSIS-Driver");
     //-->
    </script>
   </span>
   </div>
   <div id="projectbrief">Peripheral Interface for Middleware and Application Code</div>
  </td>
   <td>        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <span id="MSearchSelect"                onmouseover="return searchBox.OnSearchSelectShow()"                onmouseout="return searchBox.OnSearchSelectHide()">&#160;</span>
          <input type="text" id="MSearchField" value="" placeholder="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.svg" alt=""/></a>
          </span>
        </div>
</td>
  <!--END !PROJECT_NAME-->
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<div id="CMSISnav" class="tabs1">
  <ul class="tablist">
    <script type="text/javascript">
      writeComponentTabs.call(this);
    </script>
  </ul>
</div>
<script type="text/javascript">
  writeSubComponentTabs.call(this);
</script>
<!-- Generated by Doxygen 1.9.6 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('group__vstream__interface__gr.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>

<div class="header">
  <div class="summary">
<a href="#groups">Content</a> &#124;
<a href="#nested-classes">Data Structures</a> &#124;
<a href="#typedef-members">Typedefs</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle"><div class="title">vStream</div></div>
</div><!--header-->
<div class="contents">

<p>Driver API for Virtual Streaming interface using fixed-size data blocks (cmsis_vstream.h)  
<a href="#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="groups" name="groups"></a>
Content</h2></td></tr>
<tr class="memitem:group__vstream__return__code"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__vstream__return__code.html">Return Codes</a></td></tr>
<tr class="memdesc:group__vstream__return__code"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return codes for driver functions. Negative values indicate errors. <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:group__vstream__mode"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__vstream__mode.html">Streaming Modes</a></td></tr>
<tr class="memdesc:group__vstream__mode"><td class="mdescLeft">&#160;</td><td class="mdescRight">Streaming modes used by the <a class="el" href="group__vstream__interface__gr.html#ga906d9b85b2098b55e1be3e0f297f991b">vStreamStart</a> function. <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:group__vstream__events"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__vstream__events.html">Driver Event Flags</a></td></tr>
<tr class="memdesc:group__vstream__events"><td class="mdescLeft">&#160;</td><td class="mdescRight">Events signaled by the driver via the <a class="el" href="group__vstream__interface__gr.html#ga35a3d2abf483b5e06e6dd432e00b9d24">vStreamEvent</a> function. <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:group__vStreamStatus__t"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__vStreamStatus__t.html">Streaming Status</a></td></tr>
<tr class="memdesc:group__vStreamStatus__t"><td class="mdescLeft">&#160;</td><td class="mdescRight">Structure indicating the status of the virtual stream. <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="nested-classes" name="nested-classes"></a>
Data Structures</h2></td></tr>
<tr class="memitem:structvStreamDriver__t"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__vstream__interface__gr.html#structvStreamDriver__t">vStreamDriver_t</a></td></tr>
<tr class="memdesc:structvStreamDriver__t"><td class="mdescLeft">&#160;</td><td class="mdescRight">Access structure of the Virtual Streaming interface Driver.  <a href="group__vstream__interface__gr.html#structvStreamDriver__t">More...</a><br /></td></tr>
<tr class="separator:structvStreamDriver__t"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="typedef-members" name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr class="memitem:ga209dac25c802c700e8737b65f0b711f8"><td class="memItemLeft" align="right" valign="top">typedef void(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__vstream__interface__gr.html#ga209dac25c802c700e8737b65f0b711f8">vStreamEvent_t</a>) (uint32_t event_flags)</td></tr>
<tr class="memdesc:ga209dac25c802c700e8737b65f0b711f8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Pointer to <a class="el" href="group__vstream__interface__gr.html#ga35a3d2abf483b5e06e6dd432e00b9d24">vStreamEvent</a> : Handling of Virtual Streaming Events.  <br /></td></tr>
<tr class="separator:ga209dac25c802c700e8737b65f0b711f8"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:gad8f6d3e6e3481bbcebc4b3570122f8e7"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__vstream__interface__gr.html#gad8f6d3e6e3481bbcebc4b3570122f8e7">vStreamInitialize</a> (<a class="el" href="group__vstream__interface__gr.html#ga209dac25c802c700e8737b65f0b711f8">vStreamEvent_t</a> event_cb)</td></tr>
<tr class="memdesc:gad8f6d3e6e3481bbcebc4b3570122f8e7"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initialize Virtual Streaming interface.  <br /></td></tr>
<tr class="separator:gad8f6d3e6e3481bbcebc4b3570122f8e7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gad96bfadaff6aab67100f4e34816aaf8a"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__vstream__interface__gr.html#gad96bfadaff6aab67100f4e34816aaf8a">vStreamUninitialize</a> (void)</td></tr>
<tr class="memdesc:gad96bfadaff6aab67100f4e34816aaf8a"><td class="mdescLeft">&#160;</td><td class="mdescRight">De-initialize Virtual Streaming interface.  <br /></td></tr>
<tr class="separator:gad96bfadaff6aab67100f4e34816aaf8a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga87fca873c8ad3fd1a540e9c3ed89b41c"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__vstream__interface__gr.html#ga87fca873c8ad3fd1a540e9c3ed89b41c">vStreamSetBuf</a> (void *buf, uint32_t buf_size, uint32_t block_size)</td></tr>
<tr class="memdesc:ga87fca873c8ad3fd1a540e9c3ed89b41c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set Virtual Streaming data buffer.  <br /></td></tr>
<tr class="separator:ga87fca873c8ad3fd1a540e9c3ed89b41c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga906d9b85b2098b55e1be3e0f297f991b"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__vstream__interface__gr.html#ga906d9b85b2098b55e1be3e0f297f991b">vStreamStart</a> (uint32_t mode)</td></tr>
<tr class="memdesc:ga906d9b85b2098b55e1be3e0f297f991b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Start streaming.  <br /></td></tr>
<tr class="separator:ga906d9b85b2098b55e1be3e0f297f991b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga2ed65646645d5b96762531e20d7ca50d"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__vstream__interface__gr.html#ga2ed65646645d5b96762531e20d7ca50d">vStreamStop</a> (void)</td></tr>
<tr class="memdesc:ga2ed65646645d5b96762531e20d7ca50d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Stop streaming.  <br /></td></tr>
<tr class="separator:ga2ed65646645d5b96762531e20d7ca50d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga3a728ae2b17125d921e7ff282b7e7398"><td class="memItemLeft" align="right" valign="top">void *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__vstream__interface__gr.html#ga3a728ae2b17125d921e7ff282b7e7398">vStreamGetBlock</a> (void)</td></tr>
<tr class="memdesc:ga3a728ae2b17125d921e7ff282b7e7398"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get pointer to Virtual Streaming data block.  <br /></td></tr>
<tr class="separator:ga3a728ae2b17125d921e7ff282b7e7398"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga2cef9bfba7c2c9f6bcffdded3ba115ea"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__vstream__interface__gr.html#ga2cef9bfba7c2c9f6bcffdded3ba115ea">vStreamReleaseBlock</a> (void)</td></tr>
<tr class="memdesc:ga2cef9bfba7c2c9f6bcffdded3ba115ea"><td class="mdescLeft">&#160;</td><td class="mdescRight">Release Virtual Streaming data block.  <br /></td></tr>
<tr class="separator:ga2cef9bfba7c2c9f6bcffdded3ba115ea"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga7ef897e1a162383d0b049990570a8365"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__vStreamStatus__t.html#structvStreamStatus__t">vStreamStatus_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__vstream__interface__gr.html#ga7ef897e1a162383d0b049990570a8365">vStreamGetStatus</a> (void)</td></tr>
<tr class="memdesc:ga7ef897e1a162383d0b049990570a8365"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get Virtual Streaming status.  <br /></td></tr>
<tr class="separator:ga7ef897e1a162383d0b049990570a8365"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga35a3d2abf483b5e06e6dd432e00b9d24"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__vstream__interface__gr.html#ga35a3d2abf483b5e06e6dd432e00b9d24">vStreamEvent</a> (uint32_t event_flags)</td></tr>
<tr class="memdesc:ga35a3d2abf483b5e06e6dd432e00b9d24"><td class="mdescLeft">&#160;</td><td class="mdescRight">Callback function for handling Virtual Streaming events.  <br /></td></tr>
<tr class="separator:ga35a3d2abf483b5e06e6dd432e00b9d24"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Description</h2>
<p>Driver API for Virtual Streaming interface using fixed-size data blocks (cmsis_vstream.h) </p>
<p>The <b>vStream</b> software component provides an abstraction layer for streaming data using fixed-size blocks. It offers a standardized interface to interact with various streaming devices such as sensors, cameras, microphones, speakers, or simulated devices. It allows seamless development on one platform and deployment on another.</p>
<p><b>vStream API</b></p>
<p>The following header file defines the Application Programming Interface (API) for Virtual Streaming interface:</p><ul>
<li><b>cmsis_vstream.h</b>: Driver API for Virtual Streaming interface</li>
</ul>
<p>The driver implementation is typically a part of the Board Support Pack (BSP) for a specific board with streaming devices.</p>
<p><b>Driver Functions</b></p>
<p>All driver functions are grouped within the <a class="el" href="group__vstream__interface__gr.html#structvStreamDriver__t">vStreamDriver_t</a> access structure.</p>
<p><b>User Code Template</b></p>
<p>The <b>CMSIS Driver:vStream (API):Custom</b> component provides a stub implementation of all vStream driver functions. <br  />
 This template can be used to implement the vStream driver for your target hardware.</p>
<p>The default driver access structure is named <b>Driver_vStreamDevice</b>, but <code>Device</code> should be replaced with a specific device name, such as <code>Driver_vStreamAccelerometer</code>. See <a class="el" href="group__vstream__interface__gr.html#structvStreamDriver__t">vStreamDriver_t</a> for more details.</p>
<p><b>Code Example</b></p>
<p>The following example demonstrates how to use the vStream driver for an accelerometer:</p>
<div class="fragment"><div class="line"><span class="preprocessor">#include &quot;<a class="code" href="cmsis__vstream_8h.html">cmsis_vstream.h</a>&quot;</span></div>
<div class="line"><span class="preprocessor">#include &quot;cmsis_os2.h&quot;</span></div>
<div class="line"><span class="preprocessor">#include &quot;cmsis_compiler.h&quot;</span></div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#include &lt;stdio.h&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;string.h&gt;</span></div>
<div class="line"> </div>
<div class="line"><span class="comment">// Sensor characteristics</span></div>
<div class="line"><span class="preprocessor">#define SENSOR_DATA_BYTES_PER_SAMPLE    (6U)</span></div>
<div class="line"> </div>
<div class="line"><span class="comment">// Sensor data usage configuration</span></div>
<div class="line"><span class="preprocessor">#define SENSOR_DATA_SAMPLES_PER_SLICE   (100U)</span></div>
<div class="line"> </div>
<div class="line"><span class="comment">// Thread flag for signaling sensor data available</span></div>
<div class="line"><span class="preprocessor">#define SENSOR_DATA_READY_FLAG          (1U)</span></div>
<div class="line"> </div>
<div class="line"><span class="comment">// Raw sensor data sample structure</span></div>
<div class="line"><span class="keyword">typedef</span> <span class="keyword">struct </span>{</div>
<div class="line">  int16_t x;</div>
<div class="line">  int16_t y;</div>
<div class="line">  int16_t z;</div>
<div class="line">} accelerometer_sample_t;</div>
<div class="line"> </div>
<div class="line"><span class="keyword">static</span> uint8_t vstream_buf[(SENSOR_DATA_SAMPLES_PER_SLICE * SENSOR_DATA_BYTES_PER_SAMPLE) * 2] __ALIGNED(4);</div>
<div class="line"> </div>
<div class="line"><span class="comment">// vStream driver</span></div>
<div class="line"><span class="keyword">extern</span> <a class="code hl_struct" href="group__vstream__interface__gr.html#structvStreamDriver__t">vStreamDriver_t</a>     Driver_vStreamAccelerometer;</div>
<div class="line"><span class="keyword">static</span> <a class="code hl_struct" href="group__vstream__interface__gr.html#structvStreamDriver__t">vStreamDriver_t</a> *ptrDriver_vStreamAccelerometer = &amp;Driver_vStreamAccelerometer;</div>
<div class="line"> </div>
<div class="line"><span class="comment">// Thread identifier</span></div>
<div class="line">osThreadId_t threadId_threadDataProcess = NULL;</div>
<div class="line"> </div>
<div class="line"><span class="comment">// Local function declaration</span></div>
<div class="line">__NO_RETURN <span class="keywordtype">void</span> threadDataProcess (<span class="keywordtype">void</span> *argument);</div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line"><span class="comment">// Function that signals thread event when data is available with vStream</span></div>
<div class="line"><span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code hl_function" href="group__vstream__interface__gr.html#ga35a3d2abf483b5e06e6dd432e00b9d24">vStreamEvent</a> (uint32_t event_flags) {</div>
<div class="line"> </div>
<div class="line">  <span class="keywordflow">if</span> ((event_flags &amp; <a class="code hl_define" href="group__vstream__events.html#gae118c9f1ac1cee90ec9a5cabb539e329">VSTREAM_EVENT_DATA</a>) != 0U) {</div>
<div class="line">    <span class="comment">// Inform data processing thread that sensor data is available</span></div>
<div class="line">    osThreadFlagsSet(threadId_threadDataProcess, SENSOR_DATA_READY_FLAG);</div>
<div class="line">  }</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"><span class="comment">// Function that initializes vStream for accelerometer</span></div>
<div class="line"><span class="keywordtype">void</span> vStreamInit (<span class="keywordtype">void</span>) {</div>
<div class="line"> </div>
<div class="line">  ptrDriver_vStreamAccelerometer-&gt;<a class="code hl_variable" href="group__vstream__interface__gr.html#ae54e990fa091d20a223a8eb9a19b00d6">Initialize</a>(<a class="code hl_function" href="group__vstream__interface__gr.html#ga35a3d2abf483b5e06e6dd432e00b9d24">vStreamEvent</a>);</div>
<div class="line">  ptrDriver_vStreamAccelerometer-&gt;<a class="code hl_variable" href="group__vstream__interface__gr.html#a8656ba6148eb7e6593a6c79d12733bcb">SetBuf</a>(vstream_buf, <span class="keyword">sizeof</span>(vstream_buf), SENSOR_DATA_SAMPLES_PER_SLICE * SENSOR_DATA_BYTES_PER_SAMPLE);</div>
<div class="line">  ptrDriver_vStreamAccelerometer-&gt;<a class="code hl_variable" href="group__vstream__interface__gr.html#a288767a0e3700c438dd0b635b8620cbd">Start</a>(<a class="code hl_define" href="group__vstream__mode.html#ga9e52273038267295133f80b970ffa6d0">VSTREAM_MODE_CONTINUOUS</a>);</div>
<div class="line"> </div>
<div class="line">  threadId_threadDataProcess = osThreadNew(threadDataProcess, NULL, NULL);</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"><span class="comment">// Thread function that processes the sensor data</span></div>
<div class="line">__NO_RETURN <span class="keywordtype">void</span> threadDataProcess (<span class="keywordtype">void</span> *argument) {</div>
<div class="line">  accelerometer_sample_t *ptr_acc_sample;</div>
<div class="line">  (void) argument;</div>
<div class="line"> </div>
<div class="line">  <span class="keywordflow">for</span> (;;) {</div>
<div class="line">    uint32_t flags = osThreadFlagsWait(SENSOR_DATA_READY_FLAG, osFlagsWaitAny, osWaitForever);</div>
<div class="line"> </div>
<div class="line">    <span class="keywordflow">if</span> (((flags &amp; osFlagsError)           == 0U) &amp;&amp;         <span class="comment">// If not an error and</span></div>
<div class="line">        ((flags &amp; SENSOR_DATA_READY_FLAG) != 0U)) {         <span class="comment">// if flag is sensor data ready</span></div>
<div class="line"> </div>
<div class="line">      <span class="comment">// Get pointer to acquired sensor data</span></div>
<div class="line">      ptr_acc_sample = (accelerometer_sample_t *)ptrDriver_vStreamAccelerometer-&gt;<a class="code hl_variable" href="group__vstream__interface__gr.html#a2fba4bb58037bd194d53d4cf879cbc9c">GetBlock</a>();</div>
<div class="line"> </div>
<div class="line">      <span class="comment">// Do something with sensor data, convert, copy for ML, ...</span></div>
<div class="line">      <span class="comment">// In this example we just print it to STDIO</span></div>
<div class="line">      <span class="keywordflow">for</span> (uint32_t i = 0U; i &lt; SENSOR_DATA_SAMPLES_PER_SLICE; i++) {</div>
<div class="line">        printf(<span class="stringliteral">&quot;Acc x=%i, y=%i, z=%i\r\n&quot;</span>, ptr_acc_sample-&gt;x, ptr_acc_sample-&gt;y, ptr_acc_sample-&gt;z);</div>
<div class="line">        ptr_acc_sample++;</div>
<div class="line">      }</div>
<div class="line">    }</div>
<div class="line"> </div>
<div class="line">    <span class="comment">// Release current block for further data acquisition</span></div>
<div class="line">    ptrDriver_vStreamAccelerometer-&gt;<a class="code hl_variable" href="group__vstream__interface__gr.html#a10ffe0c6001a5d68379c696fd6cb8855">ReleaseBlock</a>();</div>
<div class="line">  }</div>
<div class="line">}</div>
<div class="ttc" id="acmsis__vstream_8h_html"><div class="ttname"><a href="cmsis__vstream_8h.html">cmsis_vstream.h</a></div></div>
<div class="ttc" id="agroup__vstream__events_html_gae118c9f1ac1cee90ec9a5cabb539e329"><div class="ttname"><a href="group__vstream__events.html#gae118c9f1ac1cee90ec9a5cabb539e329">VSTREAM_EVENT_DATA</a></div><div class="ttdeci">#define VSTREAM_EVENT_DATA</div><div class="ttdoc">Data block received/sent.</div></div>
<div class="ttc" id="agroup__vstream__interface__gr_html_a10ffe0c6001a5d68379c696fd6cb8855"><div class="ttname"><a href="group__vstream__interface__gr.html#a10ffe0c6001a5d68379c696fd6cb8855">vStreamDriver_t::ReleaseBlock</a></div><div class="ttdeci">int32_t(* ReleaseBlock)(void)</div><div class="ttdoc">Pointer to vStreamReleaseBlock : Release data block.</div><div class="ttdef"><b>Definition:</b> cmsis_vstream.h:114</div></div>
<div class="ttc" id="agroup__vstream__interface__gr_html_a288767a0e3700c438dd0b635b8620cbd"><div class="ttname"><a href="group__vstream__interface__gr.html#a288767a0e3700c438dd0b635b8620cbd">vStreamDriver_t::Start</a></div><div class="ttdeci">int32_t(* Start)(uint32_t mode)</div><div class="ttdoc">Pointer to vStreamStart : Start streaming.</div><div class="ttdef"><b>Definition:</b> cmsis_vstream.h:111</div></div>
<div class="ttc" id="agroup__vstream__interface__gr_html_a2fba4bb58037bd194d53d4cf879cbc9c"><div class="ttname"><a href="group__vstream__interface__gr.html#a2fba4bb58037bd194d53d4cf879cbc9c">vStreamDriver_t::GetBlock</a></div><div class="ttdeci">void *(* GetBlock)(void)</div><div class="ttdoc">Pointer to vStreamGetBlock : Get pointer to data block.</div><div class="ttdef"><b>Definition:</b> cmsis_vstream.h:113</div></div>
<div class="ttc" id="agroup__vstream__interface__gr_html_a8656ba6148eb7e6593a6c79d12733bcb"><div class="ttname"><a href="group__vstream__interface__gr.html#a8656ba6148eb7e6593a6c79d12733bcb">vStreamDriver_t::SetBuf</a></div><div class="ttdeci">int32_t(* SetBuf)(void *buf, uint32_t buf_size, uint32_t block_size)</div><div class="ttdoc">Pointer to vStreamSetBuf : Set Virtual Streaming data buffer.</div><div class="ttdef"><b>Definition:</b> cmsis_vstream.h:110</div></div>
<div class="ttc" id="agroup__vstream__interface__gr_html_ae54e990fa091d20a223a8eb9a19b00d6"><div class="ttname"><a href="group__vstream__interface__gr.html#ae54e990fa091d20a223a8eb9a19b00d6">vStreamDriver_t::Initialize</a></div><div class="ttdeci">int32_t(* Initialize)(vStreamEvent_t event_cb)</div><div class="ttdoc">Pointer to vStreamInitialize : Initialize Virtual Streaming interface.</div><div class="ttdef"><b>Definition:</b> cmsis_vstream.h:108</div></div>
<div class="ttc" id="agroup__vstream__interface__gr_html_ga35a3d2abf483b5e06e6dd432e00b9d24"><div class="ttname"><a href="group__vstream__interface__gr.html#ga35a3d2abf483b5e06e6dd432e00b9d24">vStreamEvent</a></div><div class="ttdeci">void vStreamEvent(uint32_t event_flags)</div><div class="ttdoc">Callback function for handling Virtual Streaming events.</div><div class="ttdef"><b>Definition:</b> vStream.txt:416</div></div>
<div class="ttc" id="agroup__vstream__interface__gr_html_structvStreamDriver__t"><div class="ttname"><a href="group__vstream__interface__gr.html#structvStreamDriver__t">vStreamDriver_t</a></div><div class="ttdoc">Access structure of the Virtual Streaming interface Driver.</div><div class="ttdef"><b>Definition:</b> cmsis_vstream.h:107</div></div>
<div class="ttc" id="agroup__vstream__mode_html_ga9e52273038267295133f80b970ffa6d0"><div class="ttname"><a href="group__vstream__mode.html#ga9e52273038267295133f80b970ffa6d0">VSTREAM_MODE_CONTINUOUS</a></div><div class="ttdeci">#define VSTREAM_MODE_CONTINUOUS</div><div class="ttdoc">Continuous mode (default)</div></div>
</div><!-- fragment --> <hr/><h2 class="groupheader">Data Structure Documentation</h2>
<a name="structvStreamDriver__t" id="structvStreamDriver__t"></a>
<h2 class="memtitle"><span class="permalink"><a href="#structvStreamDriver__t">&#9670;&#160;</a></span>vStreamDriver_t</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">struct vStreamDriver_t</td>
        </tr>
      </table>
</div><div class="memdoc">
<div class="textblock"><p>Access structure of the Virtual Streaming interface Driver. </p>
<p>This structure provides function pointers to access the vStream driver.</p>
<p>Recommended naming convention for access structures:</p><ul>
<li>Driver_vStream&lt;Device&gt;</li>
<li>Examples:<ul>
<li>Driver_vStreamAccelerometer</li>
<li>Driver_vStreamGyroscope</li>
<li>Driver_vStreamHumidity</li>
<li>Driver_vStreamTemperature</li>
<li>Driver_vStreamIMU</li>
<li>Driver_vStreamAudioIn</li>
<li>Driver_vStreamAudioOut</li>
<li>Driver_vStreamVideoIn</li>
<li>Driver_vStreamVideoOut </li>
</ul>
</li>
</ul>
</div><table class="memberdecls">
<tr><td colspan="2"><h3>Data Fields</h3></td></tr>
<tr class="memitem:ae54e990fa091d20a223a8eb9a19b00d6"><td class="memItemLeft" align="right" valign="top">int32_t(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__vstream__interface__gr.html#ae54e990fa091d20a223a8eb9a19b00d6">Initialize</a> )(<a class="el" href="group__vstream__interface__gr.html#ga209dac25c802c700e8737b65f0b711f8">vStreamEvent_t</a> event_cb)</td></tr>
<tr class="memdesc:ae54e990fa091d20a223a8eb9a19b00d6"><td class="mdescLeft">&#160;</td><td class="mdescRight">Pointer to <a class="el" href="group__vstream__interface__gr.html#gad8f6d3e6e3481bbcebc4b3570122f8e7">vStreamInitialize</a> : Initialize Virtual Streaming interface.  <br /></td></tr>
<tr class="separator:ae54e990fa091d20a223a8eb9a19b00d6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5ce2b3d7a3a07099bf07d1eb253e92e3"><td class="memItemLeft" align="right" valign="top">int32_t(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__vstream__interface__gr.html#a5ce2b3d7a3a07099bf07d1eb253e92e3">Uninitialize</a> )(void)</td></tr>
<tr class="memdesc:a5ce2b3d7a3a07099bf07d1eb253e92e3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Pointer to <a class="el" href="group__vstream__interface__gr.html#gad96bfadaff6aab67100f4e34816aaf8a">vStreamUninitialize</a> : De-initialize Virtual Streaming interface.  <br /></td></tr>
<tr class="separator:a5ce2b3d7a3a07099bf07d1eb253e92e3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8656ba6148eb7e6593a6c79d12733bcb"><td class="memItemLeft" align="right" valign="top">int32_t(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__vstream__interface__gr.html#a8656ba6148eb7e6593a6c79d12733bcb">SetBuf</a> )(void *buf, uint32_t buf_size, uint32_t block_size)</td></tr>
<tr class="memdesc:a8656ba6148eb7e6593a6c79d12733bcb"><td class="mdescLeft">&#160;</td><td class="mdescRight">Pointer to <a class="el" href="group__vstream__interface__gr.html#ga87fca873c8ad3fd1a540e9c3ed89b41c">vStreamSetBuf</a> : Set Virtual Streaming data buffer.  <br /></td></tr>
<tr class="separator:a8656ba6148eb7e6593a6c79d12733bcb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a288767a0e3700c438dd0b635b8620cbd"><td class="memItemLeft" align="right" valign="top">int32_t(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__vstream__interface__gr.html#a288767a0e3700c438dd0b635b8620cbd">Start</a> )(uint32_t mode)</td></tr>
<tr class="memdesc:a288767a0e3700c438dd0b635b8620cbd"><td class="mdescLeft">&#160;</td><td class="mdescRight">Pointer to <a class="el" href="group__vstream__interface__gr.html#ga906d9b85b2098b55e1be3e0f297f991b">vStreamStart</a> : Start streaming.  <br /></td></tr>
<tr class="separator:a288767a0e3700c438dd0b635b8620cbd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a824cbb375e082e88b77d694186ded118"><td class="memItemLeft" align="right" valign="top">int32_t(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__vstream__interface__gr.html#a824cbb375e082e88b77d694186ded118">Stop</a> )(void)</td></tr>
<tr class="memdesc:a824cbb375e082e88b77d694186ded118"><td class="mdescLeft">&#160;</td><td class="mdescRight">Pointer to <a class="el" href="group__vstream__interface__gr.html#ga2ed65646645d5b96762531e20d7ca50d">vStreamStop</a> : Stop streaming.  <br /></td></tr>
<tr class="separator:a824cbb375e082e88b77d694186ded118"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2fba4bb58037bd194d53d4cf879cbc9c"><td class="memItemLeft" align="right" valign="top">void *(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__vstream__interface__gr.html#a2fba4bb58037bd194d53d4cf879cbc9c">GetBlock</a> )(void)</td></tr>
<tr class="memdesc:a2fba4bb58037bd194d53d4cf879cbc9c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Pointer to <a class="el" href="group__vstream__interface__gr.html#ga3a728ae2b17125d921e7ff282b7e7398">vStreamGetBlock</a> : Get pointer to data block.  <br /></td></tr>
<tr class="separator:a2fba4bb58037bd194d53d4cf879cbc9c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a10ffe0c6001a5d68379c696fd6cb8855"><td class="memItemLeft" align="right" valign="top">int32_t(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__vstream__interface__gr.html#a10ffe0c6001a5d68379c696fd6cb8855">ReleaseBlock</a> )(void)</td></tr>
<tr class="memdesc:a10ffe0c6001a5d68379c696fd6cb8855"><td class="mdescLeft">&#160;</td><td class="mdescRight">Pointer to <a class="el" href="group__vstream__interface__gr.html#ga2cef9bfba7c2c9f6bcffdded3ba115ea">vStreamReleaseBlock</a> : Release data block.  <br /></td></tr>
<tr class="separator:a10ffe0c6001a5d68379c696fd6cb8855"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a73a6ae2bff16e39f152b1eb36c975731"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__vStreamStatus__t.html#structvStreamStatus__t">vStreamStatus_t</a>(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__vstream__interface__gr.html#a73a6ae2bff16e39f152b1eb36c975731">GetStatus</a> )(void)</td></tr>
<tr class="memdesc:a73a6ae2bff16e39f152b1eb36c975731"><td class="mdescLeft">&#160;</td><td class="mdescRight">Pointer to <a class="el" href="group__vstream__interface__gr.html#ga7ef897e1a162383d0b049990570a8365">vStreamGetStatus</a> : Get Virtual Streaming status.  <br /></td></tr>
<tr class="separator:a73a6ae2bff16e39f152b1eb36c975731"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h4 class="groupheader">Field Documentation</h4>
<a id="ae54e990fa091d20a223a8eb9a19b00d6" name="ae54e990fa091d20a223a8eb9a19b00d6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae54e990fa091d20a223a8eb9a19b00d6">&#9670;&#160;</a></span>Initialize</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t(* Initialize) (<a class="el" href="group__vstream__interface__gr.html#ga209dac25c802c700e8737b65f0b711f8">vStreamEvent_t</a> event_cb)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Pointer to <a class="el" href="group__vstream__interface__gr.html#gad8f6d3e6e3481bbcebc4b3570122f8e7">vStreamInitialize</a> : Initialize Virtual Streaming interface. </p>

</div>
</div>
<a id="a5ce2b3d7a3a07099bf07d1eb253e92e3" name="a5ce2b3d7a3a07099bf07d1eb253e92e3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5ce2b3d7a3a07099bf07d1eb253e92e3">&#9670;&#160;</a></span>Uninitialize</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t(* Uninitialize) (void)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Pointer to <a class="el" href="group__vstream__interface__gr.html#gad96bfadaff6aab67100f4e34816aaf8a">vStreamUninitialize</a> : De-initialize Virtual Streaming interface. </p>

</div>
</div>
<a id="a8656ba6148eb7e6593a6c79d12733bcb" name="a8656ba6148eb7e6593a6c79d12733bcb"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8656ba6148eb7e6593a6c79d12733bcb">&#9670;&#160;</a></span>SetBuf</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t(* SetBuf) (void *buf, uint32_t buf_size, uint32_t block_size)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Pointer to <a class="el" href="group__vstream__interface__gr.html#ga87fca873c8ad3fd1a540e9c3ed89b41c">vStreamSetBuf</a> : Set Virtual Streaming data buffer. </p>

</div>
</div>
<a id="a288767a0e3700c438dd0b635b8620cbd" name="a288767a0e3700c438dd0b635b8620cbd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a288767a0e3700c438dd0b635b8620cbd">&#9670;&#160;</a></span>Start</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t(* Start) (uint32_t mode)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Pointer to <a class="el" href="group__vstream__interface__gr.html#ga906d9b85b2098b55e1be3e0f297f991b">vStreamStart</a> : Start streaming. </p>

</div>
</div>
<a id="a824cbb375e082e88b77d694186ded118" name="a824cbb375e082e88b77d694186ded118"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a824cbb375e082e88b77d694186ded118">&#9670;&#160;</a></span>Stop</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t(* Stop) (void)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Pointer to <a class="el" href="group__vstream__interface__gr.html#ga2ed65646645d5b96762531e20d7ca50d">vStreamStop</a> : Stop streaming. </p>

</div>
</div>
<a id="a2fba4bb58037bd194d53d4cf879cbc9c" name="a2fba4bb58037bd194d53d4cf879cbc9c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2fba4bb58037bd194d53d4cf879cbc9c">&#9670;&#160;</a></span>GetBlock</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void *(* GetBlock) (void)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Pointer to <a class="el" href="group__vstream__interface__gr.html#ga3a728ae2b17125d921e7ff282b7e7398">vStreamGetBlock</a> : Get pointer to data block. </p>

</div>
</div>
<a id="a10ffe0c6001a5d68379c696fd6cb8855" name="a10ffe0c6001a5d68379c696fd6cb8855"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a10ffe0c6001a5d68379c696fd6cb8855">&#9670;&#160;</a></span>ReleaseBlock</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t(* ReleaseBlock) (void)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Pointer to <a class="el" href="group__vstream__interface__gr.html#ga2cef9bfba7c2c9f6bcffdded3ba115ea">vStreamReleaseBlock</a> : Release data block. </p>

</div>
</div>
<a id="a73a6ae2bff16e39f152b1eb36c975731" name="a73a6ae2bff16e39f152b1eb36c975731"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a73a6ae2bff16e39f152b1eb36c975731">&#9670;&#160;</a></span>GetStatus</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__vStreamStatus__t.html#structvStreamStatus__t">vStreamStatus_t</a>(* GetStatus) (void)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Pointer to <a class="el" href="group__vstream__interface__gr.html#ga7ef897e1a162383d0b049990570a8365">vStreamGetStatus</a> : Get Virtual Streaming status. </p>

</div>
</div>

</div>
</div>
<h2 class="groupheader">Typedef Documentation</h2>
<a id="ga209dac25c802c700e8737b65f0b711f8" name="ga209dac25c802c700e8737b65f0b711f8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga209dac25c802c700e8737b65f0b711f8">&#9670;&#160;</a></span>vStreamEvent_t</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">vStreamEvent_t</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Pointer to <a class="el" href="group__vstream__interface__gr.html#ga35a3d2abf483b5e06e6dd432e00b9d24">vStreamEvent</a> : Handling of Virtual Streaming Events. </p>
<p>Provides the typedef for the callback function <a class="el" href="group__vstream__interface__gr.html#ga35a3d2abf483b5e06e6dd432e00b9d24">vStreamEvent</a>.</p>
<p><b>Parameter for:</b></p><ul>
<li><a class="el" href="group__vstream__interface__gr.html#gad8f6d3e6e3481bbcebc4b3570122f8e7">vStreamInitialize</a> </li>
</ul>

</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="gad8f6d3e6e3481bbcebc4b3570122f8e7" name="gad8f6d3e6e3481bbcebc4b3570122f8e7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gad8f6d3e6e3481bbcebc4b3570122f8e7">&#9670;&#160;</a></span>vStreamInitialize()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t vStreamInitialize </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__vstream__interface__gr.html#ga209dac25c802c700e8737b65f0b711f8">vStreamEvent_t</a>&#160;</td>
          <td class="paramname"><em>event_cb</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Initialize Virtual Streaming interface. </p>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group__vstream__return__code.html#ga81a583e47587a531668c81e3aec7d54f">VSTREAM_OK</a> on success; otherwise, an appropriate error code (see <a class="el" href="group__vstream__return__code.html">Return Codes</a>)</dd></dl>
<p>This function prepares the Virtual Streaming interface for operation. <br  />
</p>
<p>It performs the following tasks:</p><ul>
<li>Initializes internal driver resources and streaming device interface.</li>
<li>Registers the <a class="el" href="group__vstream__interface__gr.html#ga35a3d2abf483b5e06e6dd432e00b9d24">vStreamEvent</a> event signaling callback function.</li>
</ul>
<p>The event callback function must conform to the <a class="el" href="group__vstream__interface__gr.html#ga209dac25c802c700e8737b65f0b711f8">vStreamEvent_t</a> type. <br  />
 If event signaling is not required, pass a NULL pointer for <em>event_cb</em>.</p>
<p>This function must be called before any other vStream operations.</p>
<p><b>Code Example</b>:</p>
<div class="fragment"><div class="line"><span class="preprocessor">#include &quot;<a class="code" href="cmsis__vstream_8h.html">cmsis_vstream.h</a>&quot;</span></div>
<div class="line"> </div>
<div class="line"><span class="comment">// vStream driver</span></div>
<div class="line"><span class="keyword">extern</span> <a class="code hl_struct" href="group__vstream__interface__gr.html#structvStreamDriver__t">vStreamDriver_t</a>     Driver_vStreamAccelerometer;</div>
<div class="line"><span class="keyword">static</span> <a class="code hl_struct" href="group__vstream__interface__gr.html#structvStreamDriver__t">vStreamDriver_t</a> *ptrDriver_vStreamAccelerometer = &amp;Driver_vStreamAccelerometer;</div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">int</span> main (<span class="keywordtype">void</span>) {</div>
<div class="line"> </div>
<div class="line">  SystemCoreClockUpdate();              <span class="comment">// System Initialization</span></div>
<div class="line"> </div>
<div class="line">  ptrDriver_vStreamAccelerometer-&gt;<a class="code hl_variable" href="group__vstream__interface__gr.html#ae54e990fa091d20a223a8eb9a19b00d6">Initialize</a>(NULL);</div>
<div class="line">  <span class="comment">// ...</span></div>
<div class="line">}</div>
</div><!-- fragment --> 
</div>
</div>
<a id="gad96bfadaff6aab67100f4e34816aaf8a" name="gad96bfadaff6aab67100f4e34816aaf8a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gad96bfadaff6aab67100f4e34816aaf8a">&#9670;&#160;</a></span>vStreamUninitialize()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t vStreamUninitialize </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>De-initialize Virtual Streaming interface. </p>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group__vstream__return__code.html#ga81a583e47587a531668c81e3aec7d54f">VSTREAM_OK</a> on success; otherwise, an <a class="el" href="group__vstream__return__code.html#gada179d5e6babdd84dca07bda5fa6ce0e">VSTREAM_ERROR</a> error code (see <a class="el" href="group__vstream__return__code.html">Return Codes</a>)</dd></dl>
<p>This function disables the Virtual Streaming interface and releases all associated resources that were allocated during <a class="el" href="group__vstream__interface__gr.html#gad8f6d3e6e3481bbcebc4b3570122f8e7">vStreamInitialize</a>.</p>
<p>Use this function to properly shut down the interface when streaming is no longer required. <br  />
 After calling <b>vStreamUninitialize</b>, the interface is considered inactive, and re-initialization is required to resume streaming operations.</p>
<p><b>Code Example</b>: </p><div class="fragment"><div class="line"><span class="preprocessor">#include &quot;<a class="code" href="cmsis__vstream_8h.html">cmsis_vstream.h</a>&quot;</span></div>
<div class="line"> </div>
<div class="line"><span class="comment">// vStream driver</span></div>
<div class="line"><span class="keyword">extern</span> <a class="code hl_struct" href="group__vstream__interface__gr.html#structvStreamDriver__t">vStreamDriver_t</a>     Driver_vStreamAccelerometer;</div>
<div class="line"><span class="keyword">static</span> <a class="code hl_struct" href="group__vstream__interface__gr.html#structvStreamDriver__t">vStreamDriver_t</a> *ptrDriver_vStreamAccelerometer = &amp;Driver_vStreamAccelerometer;</div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">int</span> main (<span class="keywordtype">void</span>) {</div>
<div class="line"> </div>
<div class="line">  SystemCoreClockUpdate();              <span class="comment">// System Initialization</span></div>
<div class="line"> </div>
<div class="line">  ptrDriver_vStreamAccelerometer-&gt;<a class="code hl_variable" href="group__vstream__interface__gr.html#ae54e990fa091d20a223a8eb9a19b00d6">Initialize</a>(NULL);</div>
<div class="line">  <span class="comment">// ...</span></div>
<div class="line">  ptrDriver_vStreamAccelerometer-&gt;<a class="code hl_variable" href="group__vstream__interface__gr.html#a5ce2b3d7a3a07099bf07d1eb253e92e3">Uninitialize</a>();</div>
<div class="line">}</div>
<div class="ttc" id="agroup__vstream__interface__gr_html_a5ce2b3d7a3a07099bf07d1eb253e92e3"><div class="ttname"><a href="group__vstream__interface__gr.html#a5ce2b3d7a3a07099bf07d1eb253e92e3">vStreamDriver_t::Uninitialize</a></div><div class="ttdeci">int32_t(* Uninitialize)(void)</div><div class="ttdoc">Pointer to vStreamUninitialize : De-initialize Virtual Streaming interface.</div><div class="ttdef"><b>Definition:</b> cmsis_vstream.h:109</div></div>
</div><!-- fragment --> 
</div>
</div>
<a id="ga87fca873c8ad3fd1a540e9c3ed89b41c" name="ga87fca873c8ad3fd1a540e9c3ed89b41c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga87fca873c8ad3fd1a540e9c3ed89b41c">&#9670;&#160;</a></span>vStreamSetBuf()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t vStreamSetBuf </td>
          <td>(</td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>buf</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>buf_size</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>block_size</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Set Virtual Streaming data buffer. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">buf</td><td>pointer to memory buffer used for streaming data </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">buf_size</td><td>total size of the streaming data buffer (in bytes) </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">block_size</td><td>streaming data block size (in bytes) </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group__vstream__return__code.html#ga81a583e47587a531668c81e3aec7d54f">VSTREAM_OK</a> on success; otherwise, an appropriate error code (see <a class="el" href="group__vstream__return__code.html">Return Codes</a>)</dd></dl>
<p>This function registers a memory buffer for use by the Virtual Streaming driver. <br  />
 The buffer is used for reading or writing fixed-size data blocks, depending on the streaming direction.</p>
<p>Memory buffer recommendations:</p><ul>
<li>the buffer should be aligned to a 4-byte boundary, to facilitate DMA usage.</li>
<li><em>buf_size</em> should be an integer multiple of <em>block_size</em>, otherwise the largest multiple that fits will be used.</li>
<li>a minimum of two blocks is recommended to ensure proper buffering and streaming continuity.</li>
</ul>
<p>If <em>block_size</em> is larger than <em>buf_size</em>, the function returns <a class="el" href="group__vstream__return__code.html#ga9851504cfaad15f6cdff6f01e30e6b53">VSTREAM_ERROR_PARAMETER</a>.</p>
<p>This function must be called after initialization and before starting the stream.</p>
<p><b>Code Example</b>: </p><div class="fragment"><div class="line"><span class="preprocessor">#include &quot;<a class="code" href="cmsis__vstream_8h.html">cmsis_vstream.h</a>&quot;</span></div>
<div class="line"> </div>
<div class="line"><span class="comment">// vStream driver</span></div>
<div class="line"><span class="keyword">extern</span> <a class="code hl_struct" href="group__vstream__interface__gr.html#structvStreamDriver__t">vStreamDriver_t</a>     Driver_vStreamAccelerometer;</div>
<div class="line"><span class="keyword">static</span> <a class="code hl_struct" href="group__vstream__interface__gr.html#structvStreamDriver__t">vStreamDriver_t</a> *ptrDriver_vStreamAccelerometer = &amp;Driver_vStreamAccelerometer;</div>
<div class="line"> </div>
<div class="line"><span class="keyword">static</span> uint32_t vstream_buf[256];</div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">int</span> main (<span class="keywordtype">void</span>) {</div>
<div class="line"> </div>
<div class="line">  SystemCoreClockUpdate();              <span class="comment">// System Initialization</span></div>
<div class="line"> </div>
<div class="line">  ptrDriver_vStreamAccelerometer-&gt;<a class="code hl_variable" href="group__vstream__interface__gr.html#ae54e990fa091d20a223a8eb9a19b00d6">Initialize</a>(NULL);</div>
<div class="line">  ptrDriver_vStreamAccelerometer-&gt;<a class="code hl_variable" href="group__vstream__interface__gr.html#a8656ba6148eb7e6593a6c79d12733bcb">SetBuf</a>(vstream_buf, <span class="keyword">sizeof</span>(vstream_buf), <span class="keyword">sizeof</span>(vstream_buf)/2);</div>
<div class="line">  <span class="comment">// ...</span></div>
<div class="line">  ptrDriver_vStreamAccelerometer-&gt;<a class="code hl_variable" href="group__vstream__interface__gr.html#a5ce2b3d7a3a07099bf07d1eb253e92e3">Uninitialize</a>();</div>
<div class="line">}</div>
</div><!-- fragment --> 
</div>
</div>
<a id="ga906d9b85b2098b55e1be3e0f297f991b" name="ga906d9b85b2098b55e1be3e0f297f991b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga906d9b85b2098b55e1be3e0f297f991b">&#9670;&#160;</a></span>vStreamStart()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t vStreamStart </td>
          <td>(</td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>mode</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Start streaming. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">mode</td><td>streaming mode (see <a class="el" href="group__vstream__mode.html">Streaming Modes</a>) </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group__vstream__return__code.html#ga81a583e47587a531668c81e3aec7d54f">VSTREAM_OK</a> on success; otherwise, an appropriate error code (see <a class="el" href="group__vstream__return__code.html">Return Codes</a>)</dd></dl>
<p>This function initiates the streaming operation based on the specified mode.</p>
<p>Before calling <b>vStreamStart:</b> </p><ul>
<li>The interface must be initialized using <a class="el" href="group__vstream__interface__gr.html#gad8f6d3e6e3481bbcebc4b3570122f8e7">vStreamInitialize</a>.</li>
<li>A valid buffer must be configured using <a class="el" href="group__vstream__interface__gr.html#ga87fca873c8ad3fd1a540e9c3ed89b41c">vStreamSetBuf</a>.</li>
</ul>
<p>The <em>mode</em> parameter defines the streaming behavior:</p><ul>
<li><a class="el" href="group__vstream__mode.html#ga9e52273038267295133f80b970ffa6d0">VSTREAM_MODE_CONTINUOUS</a> : Streaming continues until explicitly stopped.</li>
<li><a class="el" href="group__vstream__mode.html#ga0f49daf1cf8ffe29df18f33855751ca0">VSTREAM_MODE_SINGLE</a> : Streaming stops automatically after transferring a single data block.</li>
</ul>
<p><b>Code Example</b>: </p><div class="fragment"><div class="line"><span class="preprocessor">#include &quot;<a class="code" href="cmsis__vstream_8h.html">cmsis_vstream.h</a>&quot;</span></div>
<div class="line"> </div>
<div class="line"><span class="comment">// vStream driver</span></div>
<div class="line"><span class="keyword">extern</span> <a class="code hl_struct" href="group__vstream__interface__gr.html#structvStreamDriver__t">vStreamDriver_t</a>     Driver_vStreamAccelerometer;</div>
<div class="line"><span class="keyword">static</span> <a class="code hl_struct" href="group__vstream__interface__gr.html#structvStreamDriver__t">vStreamDriver_t</a> *ptrDriver_vStreamAccelerometer = &amp;Driver_vStreamAccelerometer;</div>
<div class="line"> </div>
<div class="line"><span class="keyword">static</span> uint32_t vstream_buf[256];</div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">int</span> main (<span class="keywordtype">void</span>) {</div>
<div class="line"> </div>
<div class="line">  SystemCoreClockUpdate();              <span class="comment">// System Initialization</span></div>
<div class="line"> </div>
<div class="line">  ptrDriver_vStreamAccelerometer-&gt;<a class="code hl_variable" href="group__vstream__interface__gr.html#ae54e990fa091d20a223a8eb9a19b00d6">Initialize</a>(NULL);</div>
<div class="line">  ptrDriver_vStreamAccelerometer-&gt;<a class="code hl_variable" href="group__vstream__interface__gr.html#a8656ba6148eb7e6593a6c79d12733bcb">SetBuf</a>(vstream_buf, <span class="keyword">sizeof</span>(vstream_buf), <span class="keyword">sizeof</span>(vstream_buf)/2);</div>
<div class="line">  ptrDriver_vStreamAccelerometer-&gt;<a class="code hl_variable" href="group__vstream__interface__gr.html#a288767a0e3700c438dd0b635b8620cbd">Start</a>(<a class="code hl_define" href="group__vstream__mode.html#ga9e52273038267295133f80b970ffa6d0">VSTREAM_MODE_CONTINUOUS</a>);</div>
<div class="line">  <span class="comment">// ...</span></div>
<div class="line">  ptrDriver_vStreamAccelerometer-&gt;<a class="code hl_variable" href="group__vstream__interface__gr.html#a5ce2b3d7a3a07099bf07d1eb253e92e3">Uninitialize</a>();</div>
<div class="line">}</div>
</div><!-- fragment --> 
</div>
</div>
<a id="ga2ed65646645d5b96762531e20d7ca50d" name="ga2ed65646645d5b96762531e20d7ca50d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga2ed65646645d5b96762531e20d7ca50d">&#9670;&#160;</a></span>vStreamStop()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t vStreamStop </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Stop streaming. </p>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group__vstream__return__code.html#ga81a583e47587a531668c81e3aec7d54f">VSTREAM_OK</a> on success; otherwise, an <a class="el" href="group__vstream__return__code.html#gada179d5e6babdd84dca07bda5fa6ce0e">VSTREAM_ERROR</a> error code (see <a class="el" href="group__vstream__return__code.html">Return Codes</a>)</dd></dl>
<p>This function stops the ongoing streaming process initiated by <a class="el" href="group__vstream__interface__gr.html#ga906d9b85b2098b55e1be3e0f297f991b">vStreamStart</a> and resets the stream, by discarding any remaining or incomplete data blocks.</p>
<p>Calling this function halts data transfers and prepares the stream for either shutdown or restart. After stopping, the stream can be restarted using <a class="el" href="group__vstream__interface__gr.html#ga906d9b85b2098b55e1be3e0f297f991b">vStreamStart</a> without requiring re-initialization or reconfiguration, provided the buffer settings remain valid.</p>
<p><b>Code Example</b>: </p><div class="fragment"><div class="line"><span class="preprocessor">#include &quot;<a class="code" href="cmsis__vstream_8h.html">cmsis_vstream.h</a>&quot;</span></div>
<div class="line"> </div>
<div class="line"><span class="comment">// vStream driver</span></div>
<div class="line"><span class="keyword">extern</span> <a class="code hl_struct" href="group__vstream__interface__gr.html#structvStreamDriver__t">vStreamDriver_t</a>     Driver_vStreamAccelerometer;</div>
<div class="line"><span class="keyword">static</span> <a class="code hl_struct" href="group__vstream__interface__gr.html#structvStreamDriver__t">vStreamDriver_t</a> *ptrDriver_vStreamAccelerometer = &amp;Driver_vStreamAccelerometer;</div>
<div class="line"> </div>
<div class="line"><span class="keyword">static</span> uint32_t vstream_buf[256];</div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">int</span> main (<span class="keywordtype">void</span>) {</div>
<div class="line"> </div>
<div class="line">  SystemCoreClockUpdate();              <span class="comment">// System Initialization</span></div>
<div class="line"> </div>
<div class="line">  ptrDriver_vStreamAccelerometer-&gt;<a class="code hl_variable" href="group__vstream__interface__gr.html#ae54e990fa091d20a223a8eb9a19b00d6">Initialize</a>(NULL);</div>
<div class="line">  ptrDriver_vStreamAccelerometer-&gt;<a class="code hl_variable" href="group__vstream__interface__gr.html#a8656ba6148eb7e6593a6c79d12733bcb">SetBuf</a>(vstream_buf, <span class="keyword">sizeof</span>(vstream_buf), <span class="keyword">sizeof</span>(vstream_buf)/2);</div>
<div class="line">  ptrDriver_vStreamAccelerometer-&gt;<a class="code hl_variable" href="group__vstream__interface__gr.html#a288767a0e3700c438dd0b635b8620cbd">Start</a>(<a class="code hl_define" href="group__vstream__mode.html#ga9e52273038267295133f80b970ffa6d0">VSTREAM_MODE_CONTINUOUS</a>);</div>
<div class="line">  <span class="comment">// ...</span></div>
<div class="line">  ptrDriver_vStreamAccelerometer-&gt;<a class="code hl_variable" href="group__vstream__interface__gr.html#a824cbb375e082e88b77d694186ded118">Stop</a>();</div>
<div class="line">  ptrDriver_vStreamAccelerometer-&gt;<a class="code hl_variable" href="group__vstream__interface__gr.html#a5ce2b3d7a3a07099bf07d1eb253e92e3">Uninitialize</a>();</div>
<div class="line">}</div>
<div class="ttc" id="agroup__vstream__interface__gr_html_a824cbb375e082e88b77d694186ded118"><div class="ttname"><a href="group__vstream__interface__gr.html#a824cbb375e082e88b77d694186ded118">vStreamDriver_t::Stop</a></div><div class="ttdeci">int32_t(* Stop)(void)</div><div class="ttdoc">Pointer to vStreamStop : Stop streaming.</div><div class="ttdef"><b>Definition:</b> cmsis_vstream.h:112</div></div>
</div><!-- fragment --> 
</div>
</div>
<a id="ga3a728ae2b17125d921e7ff282b7e7398" name="ga3a728ae2b17125d921e7ff282b7e7398"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga3a728ae2b17125d921e7ff282b7e7398">&#9670;&#160;</a></span>vStreamGetBlock()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void * vStreamGetBlock </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Get pointer to Virtual Streaming data block. </p>
<dl class="section return"><dt>Returns</dt><dd>pointer to data block, returns NULL if no block is available</dd></dl>
<p>This function provides access to the data block used for input or output operations, depending on the streaming direction.</p>
<ul>
<li>For input streams (receiving data): returns a pointer to the oldest unread data block. <br  />
 If no unread block is available, the function returns NULL.</li>
<li>For output streams (sending data): returns a pointer to the next available empty block where the application can write data. <br  />
 If no empty block is available, the function returns NULL.</li>
</ul>
<p>The returned block remains valid until it is released using <a class="el" href="group__vstream__interface__gr.html#ga2cef9bfba7c2c9f6bcffdded3ba115ea">vStreamReleaseBlock</a>.</p>
<p><b>Code Example</b>: </p><div class="fragment"><div class="line"><span class="preprocessor">#include &quot;<a class="code" href="cmsis__vstream_8h.html">cmsis_vstream.h</a>&quot;</span></div>
<div class="line"> </div>
<div class="line"><span class="comment">// vStream driver</span></div>
<div class="line"><span class="keyword">extern</span> <a class="code hl_struct" href="group__vstream__interface__gr.html#structvStreamDriver__t">vStreamDriver_t</a>     Driver_vStreamAccelerometer;</div>
<div class="line"><span class="keyword">static</span> <a class="code hl_struct" href="group__vstream__interface__gr.html#structvStreamDriver__t">vStreamDriver_t</a> *ptrDriver_vStreamAccelerometer = &amp;Driver_vStreamAccelerometer;</div>
<div class="line"> </div>
<div class="line"><span class="keyword">static</span> uint32_t vstream_buf[256];</div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">int</span> main (<span class="keywordtype">void</span>) {</div>
<div class="line">  <span class="keyword">static</span> <span class="keyword">volatile</span> uint32_t *ptr_sensor_data_block;</div>
<div class="line"> </div>
<div class="line">  SystemCoreClockUpdate();              <span class="comment">// System Initialization</span></div>
<div class="line"> </div>
<div class="line">  ptrDriver_vStreamAccelerometer-&gt;<a class="code hl_variable" href="group__vstream__interface__gr.html#ae54e990fa091d20a223a8eb9a19b00d6">Initialize</a>(NULL);</div>
<div class="line">  ptrDriver_vStreamAccelerometer-&gt;<a class="code hl_variable" href="group__vstream__interface__gr.html#a8656ba6148eb7e6593a6c79d12733bcb">SetBuf</a>(vstream_buf, <span class="keyword">sizeof</span>(vstream_buf), <span class="keyword">sizeof</span>(vstream_buf)/2);</div>
<div class="line">  ptrDriver_vStreamAccelerometer-&gt;<a class="code hl_variable" href="group__vstream__interface__gr.html#a288767a0e3700c438dd0b635b8620cbd">Start</a>(<a class="code hl_define" href="group__vstream__mode.html#ga9e52273038267295133f80b970ffa6d0">VSTREAM_MODE_CONTINUOUS</a>);</div>
<div class="line">  <span class="keywordflow">do</span> {</div>
<div class="line">    ptr_sensor_data_block = ptrDriver_vStreamAccelerometer-&gt;<a class="code hl_variable" href="group__vstream__interface__gr.html#a2fba4bb58037bd194d53d4cf879cbc9c">GetBlock</a>();</div>
<div class="line">  } <span class="keywordflow">while</span> (ptr_sensor_data_block == NULL);</div>
<div class="line">  <span class="comment">// ...</span></div>
<div class="line">  ptrDriver_vStreamAccelerometer-&gt;<a class="code hl_variable" href="group__vstream__interface__gr.html#a824cbb375e082e88b77d694186ded118">Stop</a>();</div>
<div class="line">  ptrDriver_vStreamAccelerometer-&gt;<a class="code hl_variable" href="group__vstream__interface__gr.html#a5ce2b3d7a3a07099bf07d1eb253e92e3">Uninitialize</a>();</div>
<div class="line">}</div>
</div><!-- fragment --> 
</div>
</div>
<a id="ga2cef9bfba7c2c9f6bcffdded3ba115ea" name="ga2cef9bfba7c2c9f6bcffdded3ba115ea"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga2cef9bfba7c2c9f6bcffdded3ba115ea">&#9670;&#160;</a></span>vStreamReleaseBlock()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t vStreamReleaseBlock </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Release Virtual Streaming data block. </p>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group__vstream__return__code.html#ga81a583e47587a531668c81e3aec7d54f">VSTREAM_OK</a> on success; otherwise, an <a class="el" href="group__vstream__return__code.html#gada179d5e6babdd84dca07bda5fa6ce0e">VSTREAM_ERROR</a> error code (see <a class="el" href="group__vstream__return__code.html">Return Codes</a>)</dd></dl>
<p>This function finalizes the use of the data block returned by <a class="el" href="group__vstream__interface__gr.html#ga3a728ae2b17125d921e7ff282b7e7398">vStreamGetBlock</a>.</p>
<ul>
<li>For input streams: marks the block as processed, making it available for reuse by the driver.</li>
<li>For output streams: commits the block for transmission, indicating that the data is ready to be streamed out.</li>
</ul>
<p>This function must be called after processing or preparing the data block returned by <a class="el" href="group__vstream__interface__gr.html#ga3a728ae2b17125d921e7ff282b7e7398">vStreamGetBlock</a> to maintain proper buffer flow and avoid data loss or stalling.</p>
<p><b>Code Example</b>: </p><div class="fragment"><div class="line"><span class="preprocessor">#include &quot;<a class="code" href="cmsis__vstream_8h.html">cmsis_vstream.h</a>&quot;</span></div>
<div class="line"> </div>
<div class="line"><span class="comment">// vStream driver</span></div>
<div class="line"><span class="keyword">extern</span> <a class="code hl_struct" href="group__vstream__interface__gr.html#structvStreamDriver__t">vStreamDriver_t</a>     Driver_vStreamAccelerometer;</div>
<div class="line"><span class="keyword">static</span> <a class="code hl_struct" href="group__vstream__interface__gr.html#structvStreamDriver__t">vStreamDriver_t</a> *ptrDriver_vStreamAccelerometer = &amp;Driver_vStreamAccelerometer;</div>
<div class="line"> </div>
<div class="line"><span class="keyword">static</span> uint32_t vstream_buf[256];</div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">int</span> main (<span class="keywordtype">void</span>) {</div>
<div class="line">  <span class="keyword">static</span> <span class="keyword">volatile</span> uint32_t *ptr_sensor_data_block;</div>
<div class="line"> </div>
<div class="line">  SystemCoreClockUpdate();              <span class="comment">// System Initialization</span></div>
<div class="line"> </div>
<div class="line">  ptrDriver_vStreamAccelerometer-&gt;<a class="code hl_variable" href="group__vstream__interface__gr.html#ae54e990fa091d20a223a8eb9a19b00d6">Initialize</a>(NULL);</div>
<div class="line">  ptrDriver_vStreamAccelerometer-&gt;<a class="code hl_variable" href="group__vstream__interface__gr.html#a8656ba6148eb7e6593a6c79d12733bcb">SetBuf</a>(vstream_buf, <span class="keyword">sizeof</span>(vstream_buf), <span class="keyword">sizeof</span>(vstream_buf)/2);</div>
<div class="line">  ptrDriver_vStreamAccelerometer-&gt;<a class="code hl_variable" href="group__vstream__interface__gr.html#a288767a0e3700c438dd0b635b8620cbd">Start</a>(<a class="code hl_define" href="group__vstream__mode.html#ga9e52273038267295133f80b970ffa6d0">VSTREAM_MODE_CONTINUOUS</a>);</div>
<div class="line">  <span class="keywordflow">do</span> {</div>
<div class="line">    ptr_sensor_data_block = ptrDriver_vStreamAccelerometer-&gt;<a class="code hl_variable" href="group__vstream__interface__gr.html#a2fba4bb58037bd194d53d4cf879cbc9c">GetBlock</a>();</div>
<div class="line">  } <span class="keywordflow">while</span> (ptr_sensor_data_block == NULL);</div>
<div class="line">  <span class="comment">// Do something with sensor data</span></div>
<div class="line">  <span class="comment">// ...</span></div>
<div class="line">  ptrDriver_vStreamAccelerometer-&gt;<a class="code hl_variable" href="group__vstream__interface__gr.html#a10ffe0c6001a5d68379c696fd6cb8855">ReleaseBlock</a>();</div>
<div class="line">  ptrDriver_vStreamAccelerometer-&gt;<a class="code hl_variable" href="group__vstream__interface__gr.html#a824cbb375e082e88b77d694186ded118">Stop</a>();</div>
<div class="line">  ptrDriver_vStreamAccelerometer-&gt;<a class="code hl_variable" href="group__vstream__interface__gr.html#a5ce2b3d7a3a07099bf07d1eb253e92e3">Uninitialize</a>();</div>
<div class="line">}</div>
</div><!-- fragment --> 
</div>
</div>
<a id="ga7ef897e1a162383d0b049990570a8365" name="ga7ef897e1a162383d0b049990570a8365"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga7ef897e1a162383d0b049990570a8365">&#9670;&#160;</a></span>vStreamGetStatus()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__vStreamStatus__t.html#structvStreamStatus__t">vStreamStatus_t</a> vStreamGetStatus </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Get Virtual Streaming status. </p>
<dl class="section return"><dt>Returns</dt><dd>streaming status structure (see <a class="el" href="group__vStreamStatus__t.html">Streaming Status</a>)</dd></dl>
<p>This function returns the current operational status of the Virtual Streaming interface.</p>
<p>The returned structure includes the following information:</p><ul>
<li>Streaming activity status.</li>
<li>Overflow or underflow conditions.</li>
<li>End-of-stream (EOS) indication.</li>
</ul>
<p>Use this function to monitor the health and state of the streaming process during runtime.</p>
<p><b>Code Example</b>: </p><div class="fragment"><div class="line"><span class="preprocessor">#include &quot;<a class="code" href="cmsis__vstream_8h.html">cmsis_vstream.h</a>&quot;</span></div>
<div class="line"> </div>
<div class="line"><span class="comment">// vStream driver</span></div>
<div class="line"><span class="keyword">extern</span> <a class="code hl_struct" href="group__vstream__interface__gr.html#structvStreamDriver__t">vStreamDriver_t</a>     Driver_vStreamAccelerometer;</div>
<div class="line"><span class="keyword">static</span> <a class="code hl_struct" href="group__vstream__interface__gr.html#structvStreamDriver__t">vStreamDriver_t</a> *ptrDriver_vStreamAccelerometer = &amp;Driver_vStreamAccelerometer;</div>
<div class="line"> </div>
<div class="line"><span class="keyword">static</span> uint32_t vstream_buf[256];</div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">int</span> main (<span class="keywordtype">void</span>) {</div>
<div class="line"> </div>
<div class="line">  SystemCoreClockUpdate();              <span class="comment">// System Initialization</span></div>
<div class="line"> </div>
<div class="line">  ptrDriver_vStreamAccelerometer-&gt;<a class="code hl_variable" href="group__vstream__interface__gr.html#ae54e990fa091d20a223a8eb9a19b00d6">Initialize</a>(NULL);</div>
<div class="line">  ptrDriver_vStreamAccelerometer-&gt;<a class="code hl_variable" href="group__vstream__interface__gr.html#a8656ba6148eb7e6593a6c79d12733bcb">SetBuf</a>(vstream_buf, <span class="keyword">sizeof</span>(vstream_buf), <span class="keyword">sizeof</span>(vstream_buf)/2);</div>
<div class="line">  ptrDriver_vStreamAccelerometer-&gt;<a class="code hl_variable" href="group__vstream__interface__gr.html#a288767a0e3700c438dd0b635b8620cbd">Start</a>(<a class="code hl_define" href="group__vstream__mode.html#ga9e52273038267295133f80b970ffa6d0">VSTREAM_MODE_CONTINUOUS</a>);</div>
<div class="line">  <span class="keywordflow">if</span> (ptrDriver_vStreamAccelerometer-&gt;<a class="code hl_variable" href="group__vstream__interface__gr.html#a73a6ae2bff16e39f152b1eb36c975731">GetStatus</a>().<a class="code hl_variable" href="group__vStreamStatus__t.html#ab22b96a3efad48f5a542f46c1b224800">active</a> == 0U) {</div>
<div class="line">    <span class="comment">// If streaming is not active exit</span></div>
<div class="line">  }</div>
<div class="line">  <span class="comment">// ...</span></div>
<div class="line">  ptrDriver_vStreamAccelerometer-&gt;<a class="code hl_variable" href="group__vstream__interface__gr.html#a824cbb375e082e88b77d694186ded118">Stop</a>();</div>
<div class="line">  ptrDriver_vStreamAccelerometer-&gt;<a class="code hl_variable" href="group__vstream__interface__gr.html#a5ce2b3d7a3a07099bf07d1eb253e92e3">Uninitialize</a>();</div>
<div class="line">}</div>
<div class="ttc" id="agroup__vStreamStatus__t_html_ab22b96a3efad48f5a542f46c1b224800"><div class="ttname"><a href="group__vStreamStatus__t.html#ab22b96a3efad48f5a542f46c1b224800">vStreamStatus_t::active</a></div><div class="ttdeci">uint32_t active</div><div class="ttdoc">Streaming active.</div><div class="ttdef"><b>Definition:</b> cmsis_vstream.h:52</div></div>
<div class="ttc" id="agroup__vstream__interface__gr_html_a73a6ae2bff16e39f152b1eb36c975731"><div class="ttname"><a href="group__vstream__interface__gr.html#a73a6ae2bff16e39f152b1eb36c975731">vStreamDriver_t::GetStatus</a></div><div class="ttdeci">vStreamStatus_t(* GetStatus)(void)</div><div class="ttdoc">Pointer to vStreamGetStatus : Get Virtual Streaming status.</div><div class="ttdef"><b>Definition:</b> cmsis_vstream.h:115</div></div>
</div><!-- fragment --> 
</div>
</div>
<a id="ga35a3d2abf483b5e06e6dd432e00b9d24" name="ga35a3d2abf483b5e06e6dd432e00b9d24"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga35a3d2abf483b5e06e6dd432e00b9d24">&#9670;&#160;</a></span>vStreamEvent()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void vStreamEvent </td>
          <td>(</td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>event_flags</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Callback function for handling Virtual Streaming events. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">event_flags</td><td>bitmask indicating one or more streaming events (see <a class="el" href="group__vstream__events.html">Driver Event Flags</a>)</td></tr>
  </table>
  </dd>
</dl>
<p>This user-implemented callback function is invoked by the driver to signal runtime events during streaming. <br  />
 It is registered by the <a class="el" href="group__vstream__interface__gr.html#gad8f6d3e6e3481bbcebc4b3570122f8e7">vStreamInitialize</a> function.</p>
<p>The <a class="el" href="group__vstream__events.html">event_flags</a> parameter is a bitmask where each bit represents a specific event condition.</p>
<p>Multiple events may be reported simultaneously via combined bits. Use this function to respond to runtime conditions, such as processing data, handling errors, or updating application state.</p>
<p>The following events can be signaled:</p>
<table class="cmtable">
<tr>
<th>Parameter <em>event_flags</em> </th><th>Bit </th><th>Description  <br  />
  </th></tr>
<tr>
<td><a class="el" href="group__vstream__events.html#gae118c9f1ac1cee90ec9a5cabb539e329">VSTREAM_EVENT_DATA</a> </td><td>0 </td><td>Occurs when a new block of incoming data is available or when a block of outgoing data was streamed out.  </td></tr>
<tr>
<td><a class="el" href="group__vstream__events.html#ga2ae962956cec90f02f09288d6d3c41b2">VSTREAM_EVENT_OVERFLOW</a> </td><td>1 </td><td>Occurs when a block of incoming data begins to be overwritten because it was not released in time using the <a class="el" href="group__vstream__interface__gr.html#ga2cef9bfba7c2c9f6bcffdded3ba115ea">vStreamReleaseBlock</a> function.  </td></tr>
<tr>
<td><a class="el" href="group__vstream__events.html#ga4ead4271da48d30d14ebc7222e5cf88d">VSTREAM_EVENT_UNDERFLOW</a></td><td>2 </td><td>Occurs when a block of outgoing data was not ready (committed with <a class="el" href="group__vstream__interface__gr.html#ga2cef9bfba7c2c9f6bcffdded3ba115ea">vStreamReleaseBlock</a> function) before streaming out required it.  </td></tr>
<tr>
<td><a class="el" href="group__vstream__events.html#ga72c57892d9f9a9131f923cacd1e32f75">VSTREAM_EVENT_EOS</a> </td><td>3 </td><td>Occurs when a streaming interface reached end of stream.  </td></tr>
</table>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">
      <script type="text/javascript">
        <!--
        writeFooter.call(this);
        //-->
      </script> 
    </li>
  </ul>
</div>
</body>
</html>
